﻿using System;
using System.Data;
using System.Data.Common;
using System.Collections.Generic;
using Joyintech.Common;
using Joyintech.Model.inpiao365;
using Joyintech.DALFactory;
using Joyintech.IDAL.inpiao365;

namespace Joyintech.BLL.inpiao365
{
    public class pageSplit_BLL
    {
        private readonly IpageSplit_DAL dal = DataAccess.CreateapageSplit_DAL();

        /// <summary>
        /// 获取指定栏目的分页数据项
        /// </summary>
        /// <param name="strSql">查询语句,语句尾部不可带有order by</param>
        /// <param name="orderby">如：AddDate desc</param>
        /// <param name="StartRowNum">记录开始索引</param>
        /// <param name="EndRowNum">记录结束索引</param>
        /// <returns></returns>
        public DataSet GetPagerList(string strSelect, string orderby, int StartRowNum, int EndRowNum)
        {
            return dal.GetPagerList(strSelect, orderby, StartRowNum, EndRowNum);
        }

        /// <summary>
        /// 获取查询结果
        /// </summary>
        /// <param name="strSql">查询语句</param>
        /// <returns></returns>
        public DataSet GetList(string strSql)
        {
            return dal.GetList(strSql);
        }
        /// <summary>
        /// 根据指定语句获取记录总数
        /// </summary>
        /// <param name="strSelectCount">如：select count(*) from systemNodeContent</param>
        /// <returns></returns>
        public int GetPagerTotalCount(string strSelectCount)
        {
            return dal.GetPagerTotalCount(strSelectCount);
        }

        /// <summary>
        /// 根据查询语句获取DataTable
        /// </summary>
        /// <param name="strSql"></param>
        /// <returns></returns>
        public DataTable GetTable(string strSql)
        {
            DataSet ds = GetList(strSql);

            if (ds != null && ds.Tables.Count > 0)
            {
                return ds.Tables[0];
            }

            return new DataTable();
        }
    }
}
